package com.jianz.campus_markets.controller;

import com.jianz.campus_markets.domain.ResponseResult;
import com.jianz.campus_markets.domain.entity.User;
import com.jianz.campus_markets.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Jianz
 * @version 1.0
 * @Description
 * @Email jianz8153.gmail.com
 * @Date 2023/11/22 20:24
 */

@RestController
@RequestMapping("/user")
@Api(value = "用户信息模块")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/userInfo")
    @ApiOperation(value = "获取个人信息")
    public ResponseResult userInfo(){
        return userService.userInfo();
    }

    @PutMapping("/userInfo")
    @ApiOperation(value = "更改个人信息")
    public ResponseResult updateUserInfo(@RequestBody User user){
        return userService.updateUserInfo(user);
    }

    @GetMapping("/otherUserInfo")
    @ApiOperation(value = "根据id获取别人信息")
    public ResponseResult otherUserInfo(Long id){
        return userService.otherUserInfo(id);
    }

}
